<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css" />
        <script>
            $(function() {
                $( "#start_datepicker" ).datepicker({ dateFormat: "dd.mm.yy" });
                $("#start_datepicker").datepicker();
                
                $( "#end_datepicker" ).datepicker({ dateFormat: "dd.mm.yy" });
                $("#end_datepicker").datepicker();
            });
        </script>
    </head>
    <body>
        <form:form modelAttribute="season" method="post" action="/admin/season/edit" >
            <div class="colmask threecol">
                <div class="colmid">
                    <div class="colleft">
                        <div class="col1" >
                            <h1>Score</h1>
                            <table class="simple">
                                <tr>
                                    <td>Victory condition</td>
                                    <td>
                                        <form:select path="victoryCondition" >
                                            <form:option value="0" label="By points"/>
                                            <form:option value="1" label="By wins"/>
                                        </form:select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Points for win</td>
                                    <td><form:input path="pointsForWin" /></td>
                                </tr>
                                <tr>
                                    <td>Points for draw</td>
                                    <td><form:input path="pointsForDraw" /></td>
                                </tr>
                                <tr>
                                    <td>Points for lose</td>
                                    <td><form:input path="pointsForLose" /></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col2" >
                            <h1>Basic info</h1>
                            <table class="simple">
                                <tr>
                                    <td>Name</td>
                                    <td><form:input path="name" maxlength="100" /></td>
                                </tr>
                                <tr>
                                    <td>Start date</td>
                                    <td><form:input path="startDate" id="start_datepicker"  /></td>
                                </tr>
                                <tr>
                                    <td>End date</td>
                                    <td><form:input path="endDate" id="end_datepicker" /></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col3" >
                            <h1>Admission</h1>
                            <table class="simple">
                                <tr>
                                    <td>Price [Kč]</td>
                                    <td><form:input path="admissionPrice" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
                                
            <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
                <input type="submit" value="Add" />
            </c:if>
                <br>
                <br>
                <form:errors path="*"/>
        </form:form>
    </body>
</html>
